<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
    body {
      perspective: 1000px;
    }
    
    .p {
      width: 300px;
      height: 300px;
      position: relative;
      margin: 0 auto;
      /* 开启3d权限 */
      transform-style: preserve-3d;
      transition: all 4s;
    }
    
    .p:hover {
      /* transform: rotateX(-80deg); */
      transform: rotateY(360deg);
    }
    
    .p div {
      width: 300px;
      height: 300px;
      background-color: #222;
      line-height: 300px;
      text-align: center;
      color: #fff;
      font-size: 50px;
      position: absolute;
      top: 0;
      left: 0;
    }
    /* 1. 沿着 Z轴 150px */
    /* 1.1 没有生效，父亲没有给你开启3d权限 */
    /* 1.2 开启3d权限，但是没有透视感 */
    
    .p div:nth-child(1) {
      transform: translateZ(150px);
      /* background-color: rgba(0, 0, 0, 0); */
    }
    /* 2. 沿着X -150px  绕着Y -90deg */
    
    .p div:nth-child(2) {
      transform: translateX(-150px) rotateY(-90deg);
    }
    /* 3. 沿着 Z -150px 绕着Y 180deg */
    
    .p div:nth-child(3) {
      transform: translateZ(-150px) rotateY(180deg);
    }
    /* 4. */
    
    .p div:nth-child(4) {
      transform: translateX(150px) rotateY(90deg);
    }
  </style>
</head>

<body>
  <div class="p">
    <div>1</div>
    <div>2</div>
    <div>3</div>
    <div>4</div>
  </div>
</body>

</html>